﻿namespace switchdemo
{
    // 定义一个枚举类型，可以在整个命名空间中使用
    enum Color
    {
        Red,
        Green,
        Blue
    }

    internal class Program
    {
        // 定义一个表示星期的枚举，只能在这个类中使用
        public enum Weekday
        {
            Monday,    // 默认值为 0
            Tuesday,   // 默认值为 1
            Wednesday, // 默认值为 2
            Thursday,  // 默认值为 3
            Friday,    // 默认值为 4
            Saturday,  // 默认值为 5
            Sunday     // 默认值为 6
        }


        static void Main(string[] args)
        {
            Console.WriteLine("Hello, World!");

            int x = 1;

            switch (x)
            {
                case 1:
                    Console.WriteLine("x is 1");
                    break;
                case 2:
                    Console.WriteLine("x is 2");
                    break;
                case 3:
                    Console.WriteLine("x is 3");
                    break;
                default:
                    Console.WriteLine("x is not 1, 2, or 3");
                    break;
            }

            String y = "abc";
            switch (y)
            {
                case "abc":
                    Console.WriteLine("y is abc");
                    break;
                case "def":
                    Console.WriteLine("y is def");
                    break;
                case "ghi":
                    Console.WriteLine("y is ghi");
                    break;
                default:
                    Console.WriteLine("y is not abc, def, or ghi");
                    break;
            }

            // 定义一个枚举变量
            Weekday today = Weekday.Friday;

            // 输出枚举值
            Console.WriteLine($"今天是: {today}");

            // 使用枚举值进行 switch 判断
            switch (today)
            {
                case Weekday.Monday:
                    Console.WriteLine("今天是星期一");
                    break;
                case Weekday.Friday:
                    Console.WriteLine("今天是星期五");
                    break;
                default:
                    Console.WriteLine("今天不是星期一或星期五");
                    break;
            }
        }
    }
}
